package com.costeaalex.datedrivenfilecopy.gui;

/**
 * @author Alex Costea
 * 
 * JDialog class for FTP details.
 * 
 */

import java.awt.Dimension;
import java.awt.Frame;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class FTPJDialog extends JDialog {
	
	private static final long serialVersionUID = 1L;
	private JTextField jTFHost;
	private JTextField jTFUser;
	private JTextField jTFPass;
	private JTextField jTFDirectory;
	private JButton jBOK;
	
	public FTPJDialog() {
		
	}
	
	public FTPJDialog(Frame f, String s) {
		super(f, s);
		init();
	}
	
	private void init() {
		this.setSize(300,280);
		this.setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
		
		jTFHost=new JTextField("192.168.255.42");
		jTFUser=new JTextField("stage");
		jTFPass=new JTextField("ST4g3!");
		jTFDirectory=new JTextField("website/htdocs/alex/test");
		jBOK=new JButton("Save");
		
		getContentPane().add(new JLabel("Input FTP details below."));
		getContentPane().add(Box.createRigidArea(new Dimension(0,10)));
		getContentPane().add(new JLabel("Host:"));
		getContentPane().add(jTFHost);
		getContentPane().add(new JLabel("User:"));
		getContentPane().add(jTFUser);
		getContentPane().add(new JLabel("Pass:"));
		getContentPane().add(jTFPass);
		getContentPane().add(new JLabel("Directory:"));
		getContentPane().add(jTFDirectory);
		getContentPane().add(Box.createRigidArea(new Dimension(0,15)));
		getContentPane().add(jBOK);
		getContentPane().add(Box.createRigidArea(new Dimension(0,15)));
		
	}
	
	public String[] getConnectionData() {
		String[] data= new String[4];
		data[0]=jTFHost.getText();
		data[1]=jTFUser.getText();
		data[2]=jTFPass.getText();
		
		return data;
	}
	
	public JButton getOKButton() {
		return this.jBOK;
	}
	
	public String getDestination() {
		return jTFDirectory.getText();
	}
}
